;hsqc13C.new
;dreier, November 2002

;carbonyl decoupling by shaped pulse with offset
;15N and 13C=O decoupling are not executed as long as d0 is too small

;G. Bodenhausen ans D.J. Ruben, Chem. Phys. Lett. 69, 185 (1980)
;D.R. Muhandiram et al, JMR B102, 317-321 (1993)

;pl1   : power for 1H 
;pl3   : power for 15N
;pl2   : power for 13C hard
;pl12  : power for 13C GARP decoupling
;sp12  : power for selective C=O pulse

;p1    : 90 degree hard pulse 1H
;p3    : 90 degree hard pulse 13C
;p4    : 13C pulse, 225deg for 500/600, 180deg for 750/900
;p5    : 90 degree hard pulse 15N
;pcpd2 : 90 deg cpd-pulse 13C (~85us)
;p12   : shaped 180 pulse for CO decoupling (80u)
;spnam12: shape for selective C=O pulse (gauss.128_5)

;p21   : 1m (Gradient in first INEPT)
;p22   : 800u (Gradient in first INEPT)
;p23   : 1m (Gradient for z-filter)
;p24   : 1m (Gradient for second INEPT)

;gpz1  : 19%
;gpz2  : 30%
;gpz3  : 65%
;gpz4  : 15%

;d1    : relaxation delay
;d2    : 1H-13C INEPT delay (1.7m)
;d5    : delay 3-9-19=1/(Hz between nulls)
;in0   : 1/2*SW(in Hz)

;cnst21: CO chemical shift (offset, in ppm)

#include <Avance.incl>

define delay INEPT_1
define delay INEPT_2

#define GRADIENT1  10u p21:gp1 200u
#define GRADIENT2  10u p22:gp2 200u
#define GRADIENT3  10u p23:gp3 200u
#define GRADIENT4  10u p24:gp4 200u

"p2=p1*2"
"p6=p5*2"
"p4=p3*2"

"spoff12=bf2*(cnst21/1000000)-o2"

"d0=in0/2-p1-p3*2/3.14-1u"
"INEPT_1=d2-(p21+210u)"
"INEPT_2=d2-(p24+210u)"


1  10u ze
   10u
2  1m do:f2
   20u pl9:f1 
   20u pl2:f2
   10u LOCKH_OFF
   d1 cw:f1
   10u do:f1
   20u pl1:f1  
   20u pl3:f3
   20u LOCKH_ON
;-----------------------------------------first INEPT
   (p1 ph20):f1
   GRADIENT1                
   INEPT_1                          
   (center (p2 ph20):f1 (p3 ph20 2u p4 ph21 2u p3 ph20):f2)
   GRADIENT1       
   INEPT_1
   (p1*200 ph20):f1                                                                  
   (p1 ph21):f1 
   GRADIENT2
;-----------------------------------------13C evolution
   (p3 ph1):f2
if "d0+p1>p5" goto 7                     ;check whether there is enough time for 15N pulse
   (1u d0 p2 ph20 d0 1u):f1	                 ;no time for 15N pulse
 goto 9
7  1u
if "2*d0+p2>p12+8u" goto 8                    ;is there also enough for selective 13C=O pulse?
   (refalign (d0 p2 ph20 d0 1u):f1 center (p6 ph20 1u):f3)                 ;no time for 13C pulse
 goto 9
8  (refalign (d0 p2 ph20 d0 1u):f1 center (p6 ph20 1u):f3 center (4u p12:sp12 ph20 4u 20u pl2):f2)
9  4u
   (p3 ph20):f2
   GRADIENT3
   10u
   (p1 ph20):f1
;-----------------------------------------second INEPT
   GRADIENT4
   INEPT_2
   (center (p2 ph20):f1 (p3 ph20 2u p4 ph21 2u p3 ph20):f2)
   GRADIENT4
   INEPT_2 
   GRADIENT3
   50u 
   (p11:sp1 ph26:r):f1
   10u 
   (center(p2 ph20):f1 (p6 ph20):f3)
   10u 
   (p11:sp1 ph26:r):f1  
   GRADIENT3
   50u LOCKH_OFF
  10u pl12:f2 LOCKH_OFF
;-----------------------------------------acquisition
   go=2 ph31 cpd2:f2
   1m do:f2 mc #0 to 2 F1PH(ip1, id0)
   10u do:f1
   10u do:f2
   10u do:f3
   
   10u LOCKH_OFF
exit

ph1= 0 2
ph20=0
ph21=1
ph22=2
ph23=3
ph31=2 0
ph26=2

;##/($P[1],$PL[1])= &SetPulse(f1,HP,90);
;##/if ($BF1>650) {$P[4]=2.*$P[3]} else {$P[4]=2.5*$P[3]}
;##/($P[3],$PL[2])= &SetPulse(f2,HP,90);
;##/($P[5],$PL[3])= &SetPulse(f3,HP,90);
;##/$D[5]=&round(1/(10*$BF1),.00001);
;##/($PCPD[2],$PL[12])= &SetPulse(f2,0.000085,90);
